<?php

App::uses('CrudController', 'Controller');

class RoomsController extends CrudController {
    public $_model = 'Room';

    public function admin() {
        $this->request->allowMethod('get');
        $appBosch = new stdClass();
        $this->set('appBosch', $appBosch);
        $this->set('title', __('Salas'));
        $this->set('description', __('Administración'));
    }

    protected function getRecords($param) {
        $m = $this->_model;
        $records = $this->$m->getEnabled($param);
        return $records;
    }

    protected function c($model) {
        return array(
            'id' => $model->value,
            'name' => $model->text,
            'text' => $model->text,
            'capacity' => $model->capacity
        );
    }

    protected function u($model) {
        return array(
            'id' => $model->value,
            'name' => $model->text,
            'text' => $model->text,
            'capacity' => $model->capacity
        );
    }

    protected function id($model) {
        return $model->value;
    }

    protected function resultCreate($model){
        $model['value'] = $model['id'];
        return $model;
    }
}